package servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * 08-thymeleaf操作域对象
 */
@WebServlet("/demo06")
public class Demo06Servlet extends ViewBaseServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

        //当前请求有效
        request.setAttribute("msg1","request");
        //当前会话有效
        request.getSession().setAttribute("msg2","session");
        //当前项目有效
        getServletContext().setAttribute("msg3","servletContext");
        processTemplate("demo06",request,response);

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
